package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JsonUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class Strategy extends BaseDomain {

    public static final Integer TYPE_DISABLE = -1;//禁用
    public static final Integer TYPE_NORMAL = 0;//正常
    public static final Integer TYPE_RECOMMEND  = 1;//推荐
    //所属地区id
    private Region place;

    //标题
    private String title;

    //副标题
    private String subTitle;

    //背景图片
    private String coverUrl;

    //状态
    private Integer state;

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        if (place != null){
            map.put("placeId",place.getId());
            map.put("placeName",place.getName());
        }
        return JsonUtil.toJsonString(map);
    }

    public String getStateName(){
        String stateName = "禁用";
        if (this.state == TYPE_NORMAL){
            stateName = "正常";
        }else if (this.state == TYPE_RECOMMEND){
            stateName = "推荐";
        }
        return  stateName;
    }

}